import { createRouter, createWebHistory } from 'vue-router'
import BlankLayout from '@/views/layout/BlankLayout.vue'
import DefalutLayout from '@/views/layout/DefalutLayout.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: DefalutLayout,
      children: [
        {
          path: '/',
          name: 'home',
          component: () => import('@/views/HomeView.vue')
        },
        {
          path: '/space',
          name: 'space',
          component: () => import('@/views/space/SpaceView.vue'),
          children: [
            {
              path: '/space/app',
              name: 'apps',
              component: () => import('@/views/space/app/AppListView.vue')
            }
          ]
        }
      ]
    },
    {
      path: '/',
      component: BlankLayout,
      children: [
        {
          path: '/space/app/:appId',
          name: 'app',
          component: () => import('@/views/space/app/DetailView.vue')
        }
      ]
    }
  ]
})

export default router
